\(\int \frac {A+B x^2}{x^2 (a+b x^2)} \, dx\) [64]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 20, antiderivative size = 43 \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=-\frac {A}{a x}-\frac {(A b-a B) \arctan \left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{a^{3/2} \sqrt {b}} \]

[Out]

-A/a/x-(A*b-B*a)*arctan(x*b^(1/2)/a^(1/2))/a^(3/2)/b^(1/2)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {464, 211} \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=-\frac {(A b-a B) \arctan \left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{a^{3/2} \sqrt {b}}-\frac {A}{a x} \]

[In]

Int[(A + B*x^2)/(x^2*(a + b*x^2)),x]

[Out]

-(A/(a*x)) - ((A*b - a*B)*ArcTan[(Sqrt[b]*x)/Sqrt[a]])/(a^(3/2)*Sqrt[b])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 464

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[c*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(a*e*(m + 1))), x] + Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a*e^n*(m + 1)), In
t[(e*x)^(m + n)*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[n] ||
GtQ[e, 0]) && ((GtQ[n, 0] && LtQ[m, -1]) || (LtQ[n, 0] && GtQ[m + n, -1])) &&  !ILtQ[p, -1]

Rubi steps \begin{align*} \text {integral}& = -\frac {A}{a x}-\frac {(A b-a B) \int \frac {1}{a+b x^2} \, dx}{a} \\ & = -\frac {A}{a x}-\frac {(A b-a B) \tan ^{-1}\left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{a^{3/2} \sqrt {b}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.98 \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=-\frac {A}{a x}+\frac {(-A b+a B) \arctan \left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{a^{3/2} \sqrt {b}} \]

[In]

Integrate[(A + B*x^2)/(x^2*(a + b*x^2)),x]

[Out]

-(A/(a*x)) + ((-(A*b) + a*B)*ArcTan[(Sqrt[b]*x)/Sqrt[a]])/(a^(3/2)*Sqrt[b])

Maple [A] (verified)

Time = 2.49 (sec) , antiderivative size = 37, normalized size of antiderivative = 0.86

method result size
default \(\frac {\left (-A b +B a \right ) \arctan \left (\frac {b x}{\sqrt {a b}}\right )}{a \sqrt {a b}}-\frac {A}{a x}\) \(37\)
risch \(-\frac {A}{a x}+\frac {\left (\munderset {\textit {\_R} =\operatorname {RootOf}\left (a^{3} \textit {\_Z}^{2} b +A^{2} b^{2}-2 A B a b +B^{2} a^{2}\right )}{\sum }\textit {\_R} \ln \left (\left (3 \textit {\_R}^{2} a^{3} b +2 A^{2} b^{2}-4 A B a b +2 B^{2} a^{2}\right ) x +\left (a^{2} b A -a^{3} B \right ) \textit {\_R} \right )\right )}{2}\) \(99\)

[In]

int((B*x^2+A)/x^2/(b*x^2+a),x,method=_RETURNVERBOSE)

[Out]

(-A*b+B*a)/a/(a*b)^(1/2)*arctan(b*x/(a*b)^(1/2))-A/a/x

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 105, normalized size of antiderivative = 2.44 \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=\left [\frac {{\left (B a - A b\right )} \sqrt {-a b} x \log \left (\frac {b x^{2} + 2 \, \sqrt {-a b} x - a}{b x^{2} + a}\right ) - 2 \, A a b}{2 \, a^{2} b x}, \frac {{\left (B a - A b\right )} \sqrt {a b} x \arctan \left (\frac {\sqrt {a b} x}{a}\right ) - A a b}{a^{2} b x}\right ] \]

[In]

integrate((B*x^2+A)/x^2/(b*x^2+a),x, algorithm="fricas")

[Out]

[1/2*((B*a - A*b)*sqrt(-a*b)*x*log((b*x^2 + 2*sqrt(-a*b)*x - a)/(b*x^2 + a)) - 2*A*a*b)/(a^2*b*x), ((B*a - A*b
)*sqrt(a*b)*x*arctan(sqrt(a*b)*x/a) - A*a*b)/(a^2*b*x)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 82 vs. \(2 (36) = 72\).

Time = 0.18 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.91 \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=- \frac {A}{a x} - \frac {\sqrt {- \frac {1}{a^{3} b}} \left (- A b + B a\right ) \log {\left (- a^{2} \sqrt {- \frac {1}{a^{3} b}} + x \right )}}{2} + \frac {\sqrt {- \frac {1}{a^{3} b}} \left (- A b + B a\right ) \log {\left (a^{2} \sqrt {- \frac {1}{a^{3} b}} + x \right )}}{2} \]

[In]

integrate((B*x**2+A)/x**2/(b*x**2+a),x)

[Out]

-A/(a*x) - sqrt(-1/(a**3*b))*(-A*b + B*a)*log(-a**2*sqrt(-1/(a**3*b)) + x)/2 + sqrt(-1/(a**3*b))*(-A*b + B*a)*
log(a**2*sqrt(-1/(a**3*b)) + x)/2

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.84 \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=\frac {{\left (B a - A b\right )} \arctan \left (\frac {b x}{\sqrt {a b}}\right )}{\sqrt {a b} a} - \frac {A}{a x} \]

[In]

integrate((B*x^2+A)/x^2/(b*x^2+a),x, algorithm="maxima")

[Out]

(B*a - A*b)*arctan(b*x/sqrt(a*b))/(sqrt(a*b)*a) - A/(a*x)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.84 \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=\frac {{\left (B a - A b\right )} \arctan \left (\frac {b x}{\sqrt {a b}}\right )}{\sqrt {a b} a} - \frac {A}{a x} \]

[In]

integrate((B*x^2+A)/x^2/(b*x^2+a),x, algorithm="giac")

[Out]

(B*a - A*b)*arctan(b*x/sqrt(a*b))/(sqrt(a*b)*a) - A/(a*x)

Mupad [B] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.81 \[ \int \frac {A+B x^2}{x^2 \left (a+b x^2\right )} \, dx=-\frac {A}{a\,x}-\frac {\mathrm {atan}\left (\frac {\sqrt {b}\,x}{\sqrt {a}}\right )\,\left (A\,b-B\,a\right )}{a^{3/2}\,\sqrt {b}} \]

[In]

int((A + B*x^2)/(x^2*(a + b*x^2)),x)

[Out]

- A/(a*x) - (atan((b^(1/2)*x)/a^(1/2))*(A*b - B*a))/(a^(3/2)*b^(1/2))